package com.ease.plugin.elements {
	import com.ease.core.plugin.ResourceBase;
	import com.ease.plugin.URLResource;
	import com.ease.plugin.loaderClasses.LoaderUtils;
	import com.ease.plugin.traits.LoadTrait;
	import com.ease.plugin.traits.LoaderBase;
	import com.ease.plugin.utils.URL;

	public class SWFLoader extends LoaderBase {
		public function SWFLoader() {
			super();
      }

		override public function canHandleResource(resource:ResourceBase):Boolean {
			var urlResource:URLResource = resource as URLResource;
			if (urlResource != null && urlResource.url != null) {
				var url:URL = new URL(urlResource.url);
				return (url.path.search(/\.swf$/i) != -1);
			}
			return false;
		}

		override protected function executeLoad(loadTrait:LoadTrait):void {
			LoaderUtils.loadLoadTrait(loadTrait, updateLoadTrait, false);
		}

		override protected function executeUnload(loadTrait:LoadTrait):void {
			LoaderUtils.unloadLoadTrait(loadTrait, updateLoadTrait);
		}

	}
}